﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Func.aspx.cs" Inherits="SysWebForm_Func" %>

<script runat="server">
    /* list */
    protected void gv_DataBinding(object sender, EventArgs e)
    {
        var db = new DB();
        var dt = db.Execute(string.Format("SELECT f.* FROM Func f WHERE FuncID IN ({0}) ORDER BY seq "
            , MyObj.JoinFormat(",", "'{0}'", RoleManager.Current.GetFuncsForUser())));

        (sender as DataBoundControl).DataSource = dt;
    } 
    /* end of list */
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
        <My:MyGridView ID="gv" runat="server" OnDataBinding="gv_DataBinding" OnRowCommand="gv_ItemCommand"
        DataKeyNames="FuncID" OnPageIndexChanging="gv_PageIndexChanging">
        <Columns>            
            <asp:TemplateField HeaderText="<%$Resources: Func, FuncName   %>">
                <itemtemplate>
                        <%# LocManager.Current.GetText("Func", "FuncName", Eval("Parent")) %> ->
                           <%# LocManager.Current.GetText("Func", "FuncName", Eval("FuncID")) %>
                        </itemtemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="<%$Resources: Func, Url   %>">
                <ItemTemplate>
                    <%# Eval("Url") %>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="<%$Resources: Func, Status   %>">
                <ItemTemplate>
                    <%# CodeManager.Current.GetText("Func", "Status", Eval("Status")) %>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </My:MyGridView>
</asp:Content>

